<?PHP
class OAuthButton_Widget extends WP_Widget {

	/**
	 * Register widget with WordPress.
	 */
	function __construct() {
		$widget_ops = array(
			'classname' => '',
			'description' => 'Login via Facebook/Google+'
		);
		$this->WP_Widget( 'gp_widget_oauth', 'Login with: Facebook/Google+', $widget_ops );
	}

	/**
	 * Front-end display of widget.
	 *
	 * @see WP_Widget::widget()
	 *
	 * @param array $args     Widget arguments.
	 * @param array $instance Saved values from database.
	 */
	public function widget( $args, $instance ) {
		if( is_user_logged_in() == false && function_exists('execute_ALSDKFLSDMC347529DFIDK823'))
		{
			echo '<li style="float:right; list-style:none">';
			execute_ALSDKFLSDMC347529DFIDK823('google');
			echo '</li>';
			
			echo '<li style="float:right; list-style:none">';
			execute_ALSDKFLSDMC347529DFIDK823('facebook');
			echo '</li>';
		}
	}

	/**
	 * Back-end widget form.
	 *
	 * @see WP_Widget::form()
	 *
	 * @param array $instance Previously saved values from database.
	 */
	public function form( $instance ) {
		?>
		<p>
		<input name="<?php echo $this->get_field_name( 'fbCheck' ); ?>"  type="checkbox" <?php echo checked($instance['fbCheck'],'on'); ?> />Facebook<br>
		<input name="<?php echo $this->get_field_name( 'providerGoogle' ); ?>" type="checkbox" <?php echo checked($instance['providerGoogle'],'on'); ?> />Google
		</p>
		<?php 
	}

	/**
	 * Sanitize widget form values as they are saved.
	 *
	 * @see WP_Widget::update()
	 *
	 * @param array $new_instance Values just sent to be saved.
	 * @param array $old_instance Previously saved values from database.
	 *
	 * @return array Updated safe values to be saved.
	 */
	public function update( $new_instance, $old_instance ) {
		$instance = $old_instance;
		$instance['fbCheck'] = $new_instance['fbCheck'];
		$instance['providerGoogle'] = $new_instance['providerGoogle'];
		return $instance;
	}

} // class Foo_Widget

?>
